package com.example.service.zyz;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.example.Mapper.zyz.DsdsAdjustMainDao;
import com.example.pojo.DsdsAdjustMain;
import com.example.pojo.Salesreturns;
import com.example.vo.zyz.DsdsAdjustMainVo;
import com.example.vo.zyz.MessageVo;
import com.example.vo.zyz.pageBean;

@Service
@Transactional(propagation=Propagation.REQUIRED)
public class DsdsAdjustMainBiz {
	@Autowired
	private DsdsAdjustMainDao dao;
	
	/**
	 * 分页查询
	 * @param:
	 * pagenum:当前页
	 * */
	public pageBean query(Integer pagenum){
		pageBean page = new pageBean();
		page.setPagenum(pagenum);
		page.setPagesize(1);
		page.setRowcount(dao.queryCount());
		List<DsdsAdjustMainVo> data = dao.query(pagenum);
		page.setPagedata(data);
		return page;
	}
	
	
	/**
	 * 主祥新增
	 * @param:
	 * pojo:数据对象
	 * */
	public MessageVo addDsdsAdjustMain(DsdsAdjustMain pojo){
		MessageVo msg = null;
		try {
			System.out.println("新增=="+pojo.toString());
			dao.addDsdsAdjustMain(pojo);
			msg = new MessageVo(200, "成功新增所选记录！");
		} catch (Exception e) {
			msg = new MessageVo(500, "信息新增出错，请联系管理员!");
			System.out.println(e);
		}
		 return msg;
	}
	
	/**
	 * 主祥修改
	 * @param:
	 * pojo:数据对象
	 * */
	public MessageVo updateDsdsAdjustMain(DsdsAdjustMain pojo){
		System.out.println("修改=="+pojo.toString());
		MessageVo msg = null;
		try {
			dao.updateDsdsAdjustMain(pojo);
			msg = new MessageVo(200, "成功修改所选记录！");
		} catch (Exception e) {
			msg = new MessageVo(500, "信息修改出错，请联系管理员!");
			System.out.println(e);
		}
		 return msg;
	}	
	
	/**
	 * 删除
	 * @param:
	 * id:主键
	 * */
	public void delDsdsAdjustMainById(String id){
		 dao.delDsdsAdjustMainByID(id);
	}
}
